package com.wondersgroup.fjzlpt.console.controller.rest.yljgry;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.alibaba.fastjson.JSONArray;
import com.quick.framework.boot.web.wapper.QuickPrincipal;
import com.wondersgroup.fjzlpt.console.constant.SystemConstant;

import com.wondersgroup.fjzlpt.console.utils.ControllerCommonUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.web.utils.RequestUtils;
import com.wondersgroup.fjzlpt.console.service.inter.yljgry.YljgryService;

import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/yljgry")
public class YljgryRestController {
  
	@Autowired
	private YljgryService yljgryService;
	
	@RequestMapping("/queryPageYljgry")
	public JSONObject queryPageYljgry(HttpServletRequest request)
	{
		Map map = ControllerCommonUtils.getUserQqueryPower(request);
		return yljgryService.queryPage(map);
	}
	
	@RequestMapping("/saveYljgry")
	public JSONObject saveYljgry(@RequestParam(value="uploadFile", required = false) MultipartFile file, HttpServletRequest request)
	{
		Map map = RequestUtils.GetParameterMap(request);
		map.put("RYZP", file);
		return yljgryService.saveYljgry(map);
	}
	
	@RequestMapping("/deleteYljgry")
	public JSONObject deleteYljgryxx(HttpServletRequest request)
	{
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return yljgryService.deleteYljgryxx(map);
	}
	
	/**
	 * 查询某医疗机构全部人员
	 * @param request
	 * @return
	 */
	@RequestMapping("/queryYljgryById")
	public JSONArray queryYljgryById(HttpServletRequest request)
	{
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return yljgryService.queryYljgryById(map);
	}
	
	/**
	 * 将科室信息导出到Excel
	 * @param request
	 * @return
	 */
	@RequestMapping("/downloadToExcel")
	public void downloadToExcel(HttpServletRequest request, HttpServletResponse response){
		Map map = ControllerCommonUtils.getUserQqueryPower(request);
		yljgryService.downloadToExcel(map, request, response);
	}
}
